package admin

import (
	"fmt"
	"net/http"
	"server/app"

	"github.com/gin-contrib/sessions"
	"github.com/gin-gonic/gin"
)

func Index(c *gin.Context) {
	session := sessions.Default(c)
	if session.Get("admin") == nil {
		c.HTML(http.StatusOK, "index/login", gin.H{})
		return
	}

	var a = app.Add()
	fmt.Println(a)

	c.HTML(http.StatusOK, "index/index", gin.H{
		"title": "首页",
	})
}

func Login(c *gin.Context) {
	c.HTML(http.StatusOK, "index/login", gin.H{
		"title": "首页",
	})
}
